GXPostScriptGetPrinterText
QuickDraw GX sends theGXPostScriptGetPrinterText
message to query the printer's data channel and maintain asynchronous two-way communications with a printer. Your override of theGXPostScriptGetPrinterText
message must match the following formal declaration:
OSErr MyPostScriptGetPrinterText (Handle printerTextHdl);
printerTextHdl
- A handle to the data that is output from the printer's standard output channel. The first long word in the data is treated as the length of the text.
- function result
- An error code. The value
noErr
indicates that the operation was successful.DESCRIPTION
QuickDraw GX sends theGXPostScriptGetPrinterText
message to retrieve any data that the printer sends back on the data channel. This message is sent by the default implementation of theGXOpenConnection
,GXFreeBuffer
, andGXDumpBuffer
messages. It informs QuickDraw GX of the current state of a printer. This message is not sent when printed output is directed to a file.The default implementation of
GXPostScriptGetPrinterText
message issues aPAPRead
call on the currently opened AppleTalk connection. If any text is received, it
is copied into the handle. If there is no text, the length word in the handle is set to 0.QuickDraw GX allocates a handle to 512 bytes for the status information. You can resize this handle as needed to change the size. The format of the handle is as follows:
{ long byteCount; char data[]; } **handle;The value of thebyteCount
field must be less than or equal to the size of the handle.SPECIAL CONSIDERATIONS
You can partially override theGXPostScriptGetPrinterText
message to add special handling to the default implementation. If you are not using a PAP connection, you must totally override this message.RESULT CODES
The default implementation of the
gxSegmentLoadFailedErr A required code segment could not be found,
or there was not enough memory to load it.gxPrUserAbortErr The user has canceled printing. GXPostScriptGetPrinterText
message can also return the communications errors that are listed in Table 4-2 on page 4-42.SEE ALSO
TheGXOpenConnection
message is described on page 4-131.The
GXDumpBuffer
message is described on page 4-142.The
GXFreeBuffer
message is described on page 4-143.An example of using the
GXPostScriptGetPrinterText
andGXPostScriptScanPrinterText
messages is shown in Listing 4-1.Listing 4-1 Using the
GXPostScriptGetPrinterText
andGXPostScriptScanPrinterText
messages
Handle response; /* download the request and flush the buffers */ anErr = DownloadResource(kPostScriptType, kPaperTrayQueryID); nrequire(anErr, DownloadResource); /* flush all buffers to the device */ anErr = Send_GXWriteData(nil, 0); nrequire(anErr, FlushBuffers); /* wait for a response from the printer */ response = NewHandleClear(sizeof(long)); anErr = MemError(); nrequire(anErr, GetResponseBuffer); for (;;) { if (anErr = Send_GXPostScriptGetPrinterText(response)) break; if ((** long **) response) > 0 { if (Munger(response, 4, "*", 1, "", 0) > 0) break; else { if (anErr=Send_GXPostScriptScanPrinterText(response)) break; } } }
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help